<!DOCTYPE html PUBLIC "-//W3C//XHTML 1.0 Transitional" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
	<head>
		<title>POL Scripting Reference CFGFILE.EM</title>
		<meta name="keyword" content="POL, EScript, documentation, Ultima Online, UO, packets, client, ultima online client, emulator" />
		<meta name="description" content="Penultima Online Documentation website." />
		<meta name="Author" content="Racalac, Rykard" />
		<meta name="Generator" content="POL Doc-o-matic" />
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
		<meta http-equiv="Content-Style-Type" content="text/css" />
		<link href="style.css" rel="stylesheet" type="text/css"  media="all"  />
	</head>
	<script language="JavaScript1.2" type="text/javascript">
function ExpandContract(s) {
  var bulletE = document.getElementById("bullet_"+s);
  var spanE = document.getElementById("span_"+s);
  var Expanded = bulletE.innerHTML;

  if(Expanded == '[+]') {
    spanE.style.display = 'block';
    bulletE.innerHTML = '[-]';
  }
  else { 
    spanE.style.display = 'none'; 
    bulletE.innerHTML = '[+]';
  }
}
</script>

<body>
<div class="container"><div id="doc-mini-header">
<div class="doc-home"><a href="index.html">
              Home
  				  </a></div>
<h1>
<a name="TOP"></a>
						File:
						CFGfile.em</h1>
<p>
						Description:
						Functions for accessing configuration files.<br><b>
							Last Modified:
							10/27/2007</b></p>
</div></div><div id="main"><div class="container">
<div class="doc-col_2">
<div class="doc-smallbox">
<div class="expander"><a href="javascript:ExpandContract('Functions')" id="bullet_Functions">[-]</a></div>
<center><h2>Functions:</h2></center>
<span id="span_Functions"><ul>
<li><a href="#AppendConfigFileElem">AppendConfigFileElem</a></li>
<li><a href="#FindConfigElem">FindConfigElem</a></li>
<li><a href="#GetConfigInt">GetConfigInt</a></li>
<li><a href="#GetConfigIntKeys">GetConfigIntKeys</a></li>
<li><a href="#GetConfigMaxIntKey">GetConfigMaxIntKey</a></li>
<li><a href="#GetConfigReal">GetConfigReal</a></li>
<li><a href="#GetConfigString">GetConfigString</a></li>
<li><a href="#GetConfigStringArray">GetConfigStringArray</a></li>
<li><a href="#GetConfigStringDictionary">GetConfigStringDictionary</a></li>
<li><a href="#GetConfigStringKeys">GetConfigStringKeys</a></li>
<li><a href="#ListConfigElemProps">ListConfigElemProps</a></li>
<li><a href="#LoadTusScpFile">LoadTusScpFile</a></li>
<li><a href="#ReadConfigFile">ReadConfigFile</a></li>
<li><a href="#UnloadConfigFile">UnloadConfigFile</a></li>
</ul></span>
</div>
<div class="doc-smallbox-gold">
<div class="expander"><a href="javascript:ExpandContract('Modules')" id="bullet_Modules">[-]</a></div>
<center><h2>Modules:</h2></center>
<span id="span_Modules"><ul>
<li><a href="attributesem.html">
                      Attributes
          				  </a></li>
<li><a href="basicem.html">
                      Basic
          				  </a></li>
<li><a href="boatem.html">
                      Boat
          				  </a></li>
<li><a href="cfgfileem.html">
                      CfgFile
          				  </a></li>
<li><a href="clilocem.html">
                      CliLoc
          				  </a></li>
<li><a href="datafileem.html">
                      DataFile
          				  </a></li>
<li><a href="fileem.html">
                      File
          				  </a></li>
<li><a href="guildsem.html">
                      Guild
          				  </a></li>
<li><a href="httpem.html">
                      Http
          				  </a></li>
<li><a href="mathem.html">
                      Math
          				  </a></li>
<li><a href="npcem.html">
                      Npc
          				  </a></li>
<li><a href="osem.html">
                      OS
          				  </a></li>
<li><a href="partyem.html">
                      Party
          				  </a></li>
<li><a href="polsysem.html">
                      PolSys
          				  </a></li>
<li><a href="storageem.html">
                      Storage
          				  </a></li>
<li><a href="unicodeem.html">
                      Unicode
          				  </a></li>
<li><a href="uoem.html">
                      UO
          				  </a></li>
<li><a href="utilem.html">
                      Util
          				  </a></li>
<li><a href="vitalsem.html">
                      Vitals
          				  </a></li>
</ul></span>
</div>
</div>
<div class="doc-col_23">
<div class="doc-mainbox-gold">
<div class="doc-anchor"><a href="#TOP">[^]</a></div>
<table class="doc-table" frame="void" rules="groups" width="100%" border="1" CELLPADDING="1" CELLSPACING="0">
<tbody><tr><th align="center" colspan="2"><a name="AppendConfigFileElem">AppendConfigFileElem( filename, elemtype, elemkey, properties )</a></th></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Parameters:</th></tr></tbody>
<tbody><tr id="doc-table-med">
<td>Name</td>
<td>Type</td>
</tr></tbody>
<tbody>
<tr>
<td width="50%"><var>filename</var></td>
<td>String</td>
</tr>
<tr>
<td width="50%"><var>elemtype</var></td>
<td>String</td>
</tr>
<tr>
<td width="50%"><var>elemkey</var></td>
<td>Int or String</td>
</tr>
<tr>
<td width="50%"><var>properties</var></td>
<td>Array of Arrays {propname,value}, or array of structs { name, value }</td>
</tr>
</tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Explanation</th></tr></tbody>
<tbody>
<tr><td colspan="2">Appends an element to the config file specified. Properties must be an array of structures, where each element is a structure containing a name member first, and a value member second.</td></tr>
<tr><td colspan="2">filename uses normal package descriptor format (see ReadConfigFile).</td></tr>
<tr><td colspan="2">elemtype is the string before the key in the config file, i.e. 'MyType' in the following:
</td></tr>
<tr><td colspan="2"><pre>
MyType 0x34F
{
    MyProp 3.1
}
</pre></td></tr>
<tr><td colspan="2">elemkey is 0x34F in the above example. It can be a string or integer (as in that case)</td></tr>
<tr><td colspan="2">properties must be an array of arrays with the following format:
</td></tr>
<tr><td colspan="2"><pre>
var props := array;
var a := {"MyProp1",1};
var b := {"MyProp2",2};
props.append(a);
props.append(b);
AppendConfigFileElem( ":mypkg:mycfg", "MyType", 0x34F, props );
</pre></td></tr>
</tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Return values</th></tr></tbody>
<tbody><tr><td colspan="2">1 on success</td></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Errors</th></tr></tbody>
<tbody>
<tr><td colspan="2">"Unable to find package X"</td></tr>
<tr><td colspan="2">"Poorly formed config file descriptor: X"</td></tr>
<tr><td colspan="2">"Invalid parameter type"</td></tr>
</tbody>
</table>
</div>
<div class="doc-mainbox-gold">
<div class="doc-anchor"><a href="#TOP">[^]</a></div>
<table class="doc-table" frame="void" rules="groups" width="100%" border="1" CELLPADDING="1" CELLSPACING="0">
<tbody><tr><th align="center" colspan="2"><a name="FindConfigElem">FindConfigElem( config_file, key )</a></th></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Parameters:</th></tr></tbody>
<tbody><tr id="doc-table-med">
<td>Name</td>
<td>Type</td>
</tr></tbody>
<tbody>
<tr>
<td width="50%"><var>config_file</var></td>
<td>ConfigFileRef</td>
</tr>
<tr>
<td width="50%"><var>key</var></td>
<td>String or Integer</td>
</tr>
</tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Explanation</th></tr></tbody>
<tbody>
<tr><td colspan="2">Finds a Config Element matching 'key' in the given config_file. In the following sample entry, 'applepie' is the key:
</td></tr>
<tr><td colspan="2"><pre>
Dessert applepie
{
    Cost 8
    Calories 1004
    MadeLike   grandma
    Ingredient flour
    Ingredient butter
    Ingredient apples
    Deliciousness 3.6
}
</pre></td></tr>
</tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Return values</th></tr></tbody>
<tbody><tr><td colspan="2">A Config Element Reference on success</td></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Errors</th></tr></tbody>
<tbody>
<tr><td colspan="2">"Parameter 0 must be a Config File"</td></tr>
<tr><td colspan="2">"Param 1 must be an Integer or a String"</td></tr>
<tr><td colspan="2">"Element not found"</td></tr>
</tbody>
</table>
</div>
<div class="doc-mainbox-gold">
<div class="doc-anchor"><a href="#TOP">[^]</a></div>
<table class="doc-table" frame="void" rules="groups" width="100%" border="1" CELLPADDING="1" CELLSPACING="0">
<tbody><tr><th align="center" colspan="2"><a name="GetConfigInt">GetConfigInt( element, property_name )</a></th></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Parameters:</th></tr></tbody>
<tbody><tr id="doc-table-med">
<td>Name</td>
<td>Type</td>
</tr></tbody>
<tbody>
<tr>
<td width="50%"><var>element</var></td>
<td>ConfigElementRef</td>
</tr>
<tr>
<td width="50%"><var>property_name</var></td>
<td>String</td>
</tr>
</tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Explanation</th></tr></tbody>
<tbody>
<tr><td colspan="2">Gets a piece of Integer data from a config file element reference. For example, to get the value of 'Calories' in the following element:
</td></tr>
<tr><td colspan="2"><pre>
Dessert applepie
{
    Cost 8
    Calories 1004
    MadeLike   grandma
    Ingredient flour
    Ingredient butter
    Ingredient apples
    Deliciousness 3.6
}
Use: 'var cals := GetConfigInt(element,"Calories");'
</pre></td></tr>
</tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Return values</th></tr></tbody>
<tbody><tr><td colspan="2">An Integer value for the property</td></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Errors</th></tr></tbody>
<tbody>
<tr><td colspan="2">"Invalid type in config file! (internal error)"</td></tr>
<tr><td colspan="2">"Property not found"</td></tr>
<tr><td colspan="2">"Invalid parameter type"</td></tr>
</tbody>
</table>
</div>
<div class="doc-mainbox-gold">
<div class="doc-anchor"><a href="#TOP">[^]</a></div>
<table class="doc-table" frame="void" rules="groups" width="100%" border="1" CELLPADDING="1" CELLSPACING="0">
<tbody><tr><th align="center" colspan="2"><a name="GetConfigIntKeys">GetConfigIntKeys( config_file )</a></th></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Parameters:</th></tr></tbody>
<tbody><tr id="doc-table-med">
<td>Name</td>
<td>Type</td>
</tr></tbody>
<tbody><tr>
<td width="50%"><var>config_file</var></td>
<td>ConfigFileRef</td>
</tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Explanation</th></tr></tbody>
<tbody><tr><td colspan="2">Gets an array of only all the Integer keys in the config file.</td></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Return values</th></tr></tbody>
<tbody><tr><td colspan="2">An array of integers</td></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Errors</th></tr></tbody>
<tbody><tr><td colspan="2">"GetConfigIntKeys param 0 must be a Config File"</td></tr></tbody>
</table>
</div>
<div class="doc-mainbox-gold">
<div class="doc-anchor"><a href="#TOP">[^]</a></div>
<table class="doc-table" frame="void" rules="groups" width="100%" border="1" CELLPADDING="1" CELLSPACING="0">
<tbody><tr><th align="center" colspan="2"><a name="GetConfigMaxIntKey">GetConfigMaxIntKey( config_file )</a></th></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Parameters:</th></tr></tbody>
<tbody><tr id="doc-table-med">
<td>Name</td>
<td>Type</td>
</tr></tbody>
<tbody><tr>
<td width="50%"><var>config_file</var></td>
<td>ConfigFileRef</td>
</tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Explanation</th></tr></tbody>
<tbody><tr><td colspan="2">Gets the value of the highest value integer key in the config file. This is useful if all the keys are sequentially numbered and need to be looped over.</td></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Return values</th></tr></tbody>
<tbody><tr><td colspan="2">The maximum integer key in the file</td></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Errors</th></tr></tbody>
<tbody><tr><td colspan="2">"Parameter 0 must be a Config File"</td></tr></tbody>
</table>
</div>
<div class="doc-mainbox-gold">
<div class="doc-anchor"><a href="#TOP">[^]</a></div>
<table class="doc-table" frame="void" rules="groups" width="100%" border="1" CELLPADDING="1" CELLSPACING="0">
<tbody><tr><th align="center" colspan="2"><a name="GetConfigReal">GetConfigReal( element, property_name )</a></th></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Parameters:</th></tr></tbody>
<tbody><tr id="doc-table-med">
<td>Name</td>
<td>Type</td>
</tr></tbody>
<tbody>
<tr>
<td width="50%"><var>element</var></td>
<td>ConfigElementRef</td>
</tr>
<tr>
<td width="50%"><var>property_name</var></td>
<td>String</td>
</tr>
</tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Explanation</th></tr></tbody>
<tbody>
<tr><td colspan="2">Gets a piece of Real (float) data from a config file element reference. For example, to get the value of 'Deliciousness' in the following element:
</td></tr>
<tr><td colspan="2"><pre>
Dessert applepie
{
    Cost 8
    Calories 1004
    MadeLike   grandma
    Ingredient flour
    Ingredient butter
    Ingredient apples
    Deliciousness 3.6
}
Use: 'var yum := GetConfigReal(element,"Deliciousness");'
</pre></td></tr>
</tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Return values</th></tr></tbody>
<tbody><tr><td colspan="2">An Real value for the property</td></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Errors</th></tr></tbody>
<tbody>
<tr><td colspan="2">"Invalid type in config file! (internal error)"</td></tr>
<tr><td colspan="2">"Property not found"</td></tr>
<tr><td colspan="2">"Invalid parameter type"</td></tr>
</tbody>
</table>
</div>
<div class="doc-mainbox-gold">
<div class="doc-anchor"><a href="#TOP">[^]</a></div>
<table class="doc-table" frame="void" rules="groups" width="100%" border="1" CELLPADDING="1" CELLSPACING="0">
<tbody><tr><th align="center" colspan="2"><a name="GetConfigString">GetConfigString( element, property_name )</a></th></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Parameters:</th></tr></tbody>
<tbody><tr id="doc-table-med">
<td>Name</td>
<td>Type</td>
</tr></tbody>
<tbody>
<tr>
<td width="50%"><var>element</var></td>
<td>ConfigElementRef</td>
</tr>
<tr>
<td width="50%"><var>property_name</var></td>
<td>String</td>
</tr>
</tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Explanation</th></tr></tbody>
<tbody>
<tr><td colspan="2">Gets a piece of String data from a config file element reference. For example, to get the value of 'MadeLike' in the following element:
</td></tr>
<tr><td colspan="2"><pre>
Dessert applepie
{
    Cost 8
    Calories 1004
    MadeLike   grandma
    Ingredient flour
    Ingredient butter
    Ingredient apples
    Deliciousness 3.6
}
Use: 'var madelike := GetConfigString(element,"MadeLike");'
</pre></td></tr>
</tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Return values</th></tr></tbody>
<tbody><tr><td colspan="2">An Real value for the property</td></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Errors</th></tr></tbody>
<tbody>
<tr><td colspan="2">"Invalid type in config file! (internal error)"</td></tr>
<tr><td colspan="2">"Property not found"</td></tr>
<tr><td colspan="2">"Invalid parameter type"</td></tr>
</tbody>
</table>
</div>
<div class="doc-mainbox-gold">
<div class="doc-anchor"><a href="#TOP">[^]</a></div>
<table class="doc-table" frame="void" rules="groups" width="100%" border="1" CELLPADDING="1" CELLSPACING="0">
<tbody><tr><th align="center" colspan="2"><a name="GetConfigStringArray">GetConfigStringArray( element, property_name )</a></th></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Parameters:</th></tr></tbody>
<tbody><tr id="doc-table-med">
<td>Name</td>
<td>Type</td>
</tr></tbody>
<tbody>
<tr>
<td width="50%"><var>element</var></td>
<td>ConfigElementRef</td>
</tr>
<tr>
<td width="50%"><var>property_name</var></td>
<td>String</td>
</tr>
</tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Explanation</th></tr></tbody>
<tbody>
<tr><td colspan="2">For elements with multiple occurrences of a given property, returns an array containing each occurrence.</td></tr>
<tr><td colspan="2">For example, to get all the ingredients in the following element:
</td></tr>
<tr><td colspan="2"><pre>
Dessert applepie
{
    Cost 8
    Calories 1004
    MadeLike   grandma
    Ingredient flour
    Ingredient butter
    Ingredient apples
    Deliciousness 3.6
}
Use: 'var ingredients := GetConfigStringArray(element,"Ingredient");'
'ingredients' now contains 'flour', 'butter', and 'apples'.
</pre></td></tr>
<tr><td colspan="2">Value of the properties are always returned as strings. If the values are ints or reals, use CInt() or CDbl() to cast the values to the correct type.</td></tr>
</tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Return values</th></tr></tbody>
<tbody><tr><td colspan="2">An array of strings.</td></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Errors</th></tr></tbody>
<tbody><tr><td colspan="2">"Invalid parameter type"</td></tr></tbody>
</table>
</div>
<div class="doc-mainbox-gold">
<div class="doc-anchor"><a href="#TOP">[^]</a></div>
<table class="doc-table" frame="void" rules="groups" width="100%" border="1" CELLPADDING="1" CELLSPACING="0">
<tbody><tr><th align="center" colspan="2"><a name="GetConfigStringDictionary">GetConfigStringDictionary( element, property_name )</a></th></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Parameters:</th></tr></tbody>
<tbody><tr id="doc-table-med">
<td>Name</td>
<td>Type</td>
</tr></tbody>
<tbody>
<tr>
<td width="50%"><var>element</var></td>
<td>ConfigElementRef</td>
</tr>
<tr>
<td width="50%"><var>property_name</var></td>
<td>String</td>
</tr>
</tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Explanation</th></tr></tbody>
<tbody>
<tr><td colspan="2">Works similarly to GetConfigStringArray() but will take the first word on the line and use it for the key.</td></tr>
<tr><td colspan="2">For example, to get all the ingredients in the following element:
</td></tr>
<tr><td colspan="2"><pre>
Dessert applepie
{
    Cost 8
    Calories 1004
    MadeLike   grandma
    Ingredient flour 1 kg
    Ingredient butter 2 kg
    Ingredient apples 3 kg
    Deliciousness 3.6
}
Use: 'var ingredients := GetConfigStringDictionary(element,"Ingredient");'
'ingredients' now contains ['flour'] = '1 kg', ['butter'] = '2 kg', and ['apples'] = '3 kg'.</pre></td></tr>
<tr><td colspan="2">Value of the properties are always returned as strings. If the values are ints or reals, use CInt() or CDbl() to cast the values to the correct type.</td></tr>
</tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Return values</th></tr></tbody>
<tbody><tr><td colspan="2">Dictionary with Strings</td></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Errors</th></tr></tbody>
<tbody><tr><td colspan="2">"Invalid parameter type"</td></tr></tbody>
</table>
</div>
<div class="doc-mainbox-gold">
<div class="doc-anchor"><a href="#TOP">[^]</a></div>
<table class="doc-table" frame="void" rules="groups" width="100%" border="1" CELLPADDING="1" CELLSPACING="0">
<tbody><tr><th align="center" colspan="2"><a name="GetConfigStringKeys">GetConfigStringKeys( config_file )</a></th></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Parameters:</th></tr></tbody>
<tbody><tr id="doc-table-med">
<td>Name</td>
<td>Type</td>
</tr></tbody>
<tbody><tr>
<td width="50%"><var>config_file</var></td>
<td>ConfigFileRef</td>
</tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Explanation</th></tr></tbody>
<tbody><tr><td colspan="2">Gets an array of all the String keys, AND integer keys (returned as strings) in the config file.</td></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Return values</th></tr></tbody>
<tbody><tr><td colspan="2">An array of strings</td></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Errors</th></tr></tbody>
<tbody><tr><td colspan="2">"GetConfigStringKeys param 0 must be a Config File"</td></tr></tbody>
</table>
</div>
<div class="doc-mainbox-gold">
<div class="doc-anchor"><a href="#TOP">[^]</a></div>
<table class="doc-table" frame="void" rules="groups" width="100%" border="1" CELLPADDING="1" CELLSPACING="0">
<tbody><tr><th align="center" colspan="2"><a name="ListConfigElemProps">ListConfigElemProps( element )</a></th></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Parameters:</th></tr></tbody>
<tbody><tr id="doc-table-med">
<td>Name</td>
<td>Type</td>
</tr></tbody>
<tbody><tr>
<td width="50%"><var>element</var></td>
<td>ConfigElementRef</td>
</tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Explanation</th></tr></tbody>
<tbody><tr><td colspan="2">Gets an array of the element's property-names (as unique strings)</td></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Return values</th></tr></tbody>
<tbody><tr><td colspan="2">An array of strings</td></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Errors</th></tr></tbody>
<tbody><tr><td colspan="2">"Invalid parameter type"</td></tr></tbody>
</table>
</div>
<div class="doc-mainbox-gold">
<div class="doc-anchor"><a href="#TOP">[^]</a></div>
<table class="doc-table" frame="void" rules="groups" width="100%" border="1" CELLPADDING="1" CELLSPACING="0">
<tbody><tr><th align="center" colspan="2"><a name="LoadTusScpFile">LoadTusScpFile( filename )</a></th></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Parameters:</th></tr></tbody>
<tbody><tr id="doc-table-med">
<td>Name</td>
<td>Type</td>
</tr></tbody>
<tbody><tr>
<td width="50%"><var>filename</var></td>
<td>String, see explaination</td>
</tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Explanation</th></tr></tbody>
<tbody>
<tr><td colspan="2">Very Old Function - may not work any longer!
</td></tr>
<tr><td colspan="2"><pre>
    // 
    // Load a TUS .SCP file as a config file
    //
    // Filename must be alphanumeric only.  The file must exist
    // in pol/import/tus.  So LoadTusScpFile( "grayacct" ) will
    // try to load "/pol/import/tus/grayacct.scp"
    // 
    // Header properties, if any, in cfgfile[0]
    // Other elements numbered sequentially from 1
    // The part in brackets ("[WORLDITEM 04000]") will appear in two ways:
    //   1) as a "_key" property
    //   2) as a property itself (name=WORLDITEM, value=0x4000)
    //
    //
    // So,if you had the following as the first element
    //   [WORLDITEM 04000]
    //   SERIAL=080
    //   P=1,2,3
    // And 'var tusfile' was the result of LoadTusScpFile, then
    // tusfile[1]._key      is "WORLDITEM 04000"
    // tusfile[1].worlditem is 0x4000
    // tusfile[1].serial    is 0x80
    // tusfile[1].p         is "1,2,3"
    //
</pre></td></tr>
</tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Return values</th></tr></tbody>
<tbody><tr><td colspan="2">A Config File Reference</td></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Errors</th></tr></tbody>
<tbody>
<tr><td colspan="2">"Invalid parameter type"</td></tr>
<tr><td colspan="2">"Filename cannot include path information or special characters"</td></tr>
<tr><td colspan="2">"File not found"</td></tr>
</tbody>
</table>
</div>
<div class="doc-mainbox-gold">
<div class="doc-anchor"><a href="#TOP">[^]</a></div>
<table class="doc-table" frame="void" rules="groups" width="100%" border="1" CELLPADDING="1" CELLSPACING="0">
<tbody><tr><th align="center" colspan="2"><a name="ReadConfigFile">ReadConfigFile(filename)</a></th></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Parameters:</th></tr></tbody>
<tbody><tr id="doc-table-med">
<td>Name</td>
<td>Type</td>
</tr></tbody>
<tbody><tr>
<td width="50%"><var>filename</var></td>
<td>String (not including '.cfg')</td>
</tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Explanation</th></tr></tbody>
<tbody>
<tr><td colspan="2">Reads a given config file and returns a reference to it for use with other functions in this EM file.</td></tr>
<tr><td colspan="2">Note, takes the usual package filespec: '::cfgfile' is in /pol/config, '::regions/cfgfile' is in /pol/regions, ':*:cfgfile' is a combination of all configs named 'cfgfile' in all pacakages, and ':pkgname:cfgfile' is a specific cfgfile inside a package. If only 'cfgfile' is passed, POL looks for it first in /pol/config and then in each package sequentially.</td></tr>
</tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Return values</th></tr></tbody>
<tbody><tr><td colspan="2">A ConfigFileRef on success.</td></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Errors</th></tr></tbody>
<tbody>
<tr><td colspan="2">"Unable to find package X"</td></tr>
<tr><td colspan="2">"Poorly formed config file descriptor: X"</td></tr>
<tr><td colspan="2">"Config file not found"</td></tr>
<tr><td colspan="2">"Invalid parameter type"</td></tr>
</tbody>
</table>
</div>
<div class="doc-mainbox-gold">
<div class="doc-anchor"><a href="#TOP">[^]</a></div>
<table class="doc-table" frame="void" rules="groups" width="100%" border="1" CELLPADDING="1" CELLSPACING="0">
<tbody><tr><th align="center" colspan="2"><a name="UnloadConfigFile">UnloadConfigFile( filename )</a></th></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Parameters:</th></tr></tbody>
<tbody><tr id="doc-table-med">
<td>Name</td>
<td>Type</td>
</tr></tbody>
<tbody><tr>
<td width="50%"><var>filename</var></td>
<td>String</td>
</tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Explanation</th></tr></tbody>
<tbody>
<tr><td colspan="2">Unloads a config file from memory.  If other scripts reference the config file specified, it will remain in memory until they no longer reference it.  Scripts which call ReadConfigFile() after this, however, will re-read the config file and use the newer version.</td></tr>
<tr><td colspan="2">Has no effect on most core-read config files like itemdesc.cfg, npcdesc.cfg, etc (See ReloadConfiguation in polsys.em)</td></tr>
<tr><td colspan="2">filename uses the normal package descriptor format (see ReadConfigFile)</td></tr>
</tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Return values</th></tr></tbody>
<tbody><tr><td colspan="2">Integer number of files unloaded</td></tr></tbody>
<tbody><tr id="doc-table-dark"><th align="left" colspan="2">Errors</th></tr></tbody>
<tbody>
<tr><td colspan="2">"Unable to find package X"</td></tr>
<tr><td colspan="2">"Poorly formed config file descriptor: X"</td></tr>
<tr><td colspan="2">"Invalid parameter"</td></tr>
</tbody>
</table>
</div>
</div>
</div></div>
</div></div>
<div id="footer">
	<div class="container">
    <p >
      If you <i>know</i> if any information is incorrect on these pages, mail your corrections to polteam@polserver.com
    </p>
    <p >
      Copyright &copy;2003-2009 David Carpman and POL Development Team, all rights reserved. DO NOT REPRODUCE, MIRROR, ALTER, SPINDLE, MUTILATE, OR SIT ON.
    </p>
    </div>
    </div>
    </body>
    </html>
   